import * as React from 'react'
import { Form } from 'antd'
import { BaseDetail } from '@/pages/templates/base-detail'
import api from '@/api'

class CustomerDetail extends BaseDetail {
  state = {
    ...this.state,
    commissionerOptions: [],
  }
  apiDetail = api.customer.detail
  apiUpdate = api.customer.update
  displayRows = [
    {
      key: 'customer_id',
      label: '客户代码',
      attr: { disabled: true },
      rules: [{ required: true, message: '客户代码为必填项' }]
    },
    { key: 'componey_name', label: '公司名称', span: 24 },
    {
      key: 'commissioner',
      label: '客户专员',
      type: 'select',
      options: this.state.commissionerOptions
    },
    { key: 'principal', label: '负责人' },
    { key: 'level', label: '级别', type: 'select', options: [
      { value: '1', level: '①' },
      { value: '2', level: '②' },
      { value: '3', level: '③' }
    ] },
    { key: 'contact', label: '联系方式', span: 24 },
    {
      key: 'address',
      label: '地址',
      span: 24,
      type: 'textArea',
      attr: { rows: 2 }
    },
    {
      key: 'main_business', label: '主要营业方向', span: 24,
      type: 'textArea',
      attr: { rows: 3 }
    },
    {
      key: 'comment', label: '备注', span: 24,
      type: 'textArea',
      attr: { rows: 3 }
    }
  ]
}
export default Form.create()(CustomerDetail)